package UIUtils
{
	import flash.display.Loader;
	import flash.events.Event;
	import flash.net.URLRequest;
	import flash.net.navigateToURL;
	
	public class uif_metrica extends Object {
		private static var _views: Object;
		public function uif_metrica() {
			super();
			_views = new Object();
		}
		
		public static function view(mtericaID: int): void {
			if (!_views[metricaID]) {
				var loader: Loader = new Loader();
				loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e: Event): void {
					_views[metricaID] = loader;
				});
				loader.load(new URLRequest('http://mc.yandex.ru/watch/' + metricaID));
			}
		}
		
		public static function hit(mtericaID: int, link: String, title: String=''): void {
			navigateToURL(new URLRequest("javascript:(new Ya.Metrika(" + metricaID + ")).hit('" + link + "', '" + title + "', null)"), "_self");
		}
	}
}